---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: {{ .Chart.Name }}
  namespace: d8-{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "local-path-provisioner")) | nindent 2 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: d8:{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "local-path-provisioner")) | nindent 2 }}
rules:
- apiGroups: [ "" ]
  resources: [ "nodes", "persistentvolumeclaims", "configmaps" ]
  verbs: [ "get", "list", "watch" ]
- apiGroups: [ "" ]
  resources: [ "endpoints", "persistentvolumes", "pods" ]
  verbs: [ "*" ]
- apiGroups: [ "" ]
  resources: [ "events" ]
  verbs: [ "create", "patch" ]
- apiGroups: [ "storage.k8s.io" ]
  resources: [ "storageclasses" ]
  verbs: [ "get", "list", "watch" ]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: d8:{{ .Chart.Name }}
  {{- include "helm_lib_module_labels" (list . (dict "app" "local-path-provisioner")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:{{ .Chart.Name }}
subjects:
- kind: ServiceAccount
  name: {{ .Chart.Name }}
  namespace: d8-{{ .Chart.Name }}
